#include<bits/stdc++.h>
using namespace std;
#define int long long

int a[100005];

signed main() {
	int n, q;
	cin >> n >> q;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	while (q--) {
		int l, r;
		cin >> l >> r;
		if (r - l > 100)
			cout << "YES" << endl;
		else {
			int flag = 0;
			for (int i = l; i <= r; i++) {
				if (flag)	break;
				for (int j = i + 1; j <= r; j++) {
					if (abs(a[i] - a[j]) <= 365) {
						flag = 1;
						break;
					}
				}
			}
			if (flag)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	}
	return 0;
}
